home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Games Collection 1 / software vault.zip / software vault / CDR10 / TGE129C.ZIP / SOURCE / TGEFONT.H < prev    next >
C/C++ Source or Header  |  1993-08-20  |  3KB  |  96 lines

  1. /*****************************************************************************
  2. *       The Graphics Engine version 1.29ßC                                   *
  3. *                                                                            *
  4. *       The Graphics Engine code and documentation are Copyright (c) 1993    *
  5. *       by Matthew Hildebrand.                                               *
  6. *                                                                            *
  7. *       Unauthorised usage or modification of any or all of The Graphics     *
  8. *       Engine is strictly prohibited.                                       *
  9. *****************************************************************************/
  10.  
  11. #ifndef FONTdotH
  12. #define FONTdotH
  13.  
  14.  
  15. //*****
  16. //***** Bitmapped font services class
  17. //*****
  18.  
  19. class Font
  20. {
  21.   unsigned charWide, charDeep;        // character cell dimensions
  22.   unsigned fgColour, bgColour;        // font colours (0=invisible)
  23.   void far *rawData;            // character data here
  24.   void far *addrArray[256];        // address of each character
  25.   void far *image;            // buffer for putImage()
  26.   unsigned charSize;            // character image size in bytes
  27. public:
  28.   Font(char *filename, unsigned char fg=1, unsigned char bg=0);
  29.   ~Font();
  30.   inline int status(void);        // return status code (0=ERROR)
  31.   unsigned wide(char *str);        // string width in pixels
  32.   inline unsigned wide(char ch);    // character width in pixels
  33.   inline unsigned maxWide(void);        // max character width in pixels
  34.   inline unsigned deep(char *str);    // string depth in pixels
  35.   inline unsigned deep(char ch);        // character depth in pixels
  36.   inline unsigned maxDeep(void);    // max character depth in pixels
  37.   void put(int x, int y, char *str);    // write a string
  38.   void put(int x, int y, char ch);    // write a single character
  39.   inline void foreground(unsigned c);    // set foreground colour
  40.   inline void background(unsigned c);    // set background colour
  41.   inline unsigned foreground(void);    // get foreground colour
  42.   inline unsigned background(void);    // get background colour
  43. };
  44.  
  45.  
  46. inline int Font::status(void)
  47. {
  48.   return (rawData==NULL ? 0 : 1);
  49. }
  50.  
  51. inline unsigned Font::wide(char)
  52. {
  53.   return (charWide);
  54. }
  55.  
  56. inline unsigned Font::maxWide(void)
  57. {
  58.   return (charWide);
  59. }
  60.  
  61. inline unsigned Font::deep(char *)
  62. {
  63.   return (charDeep);
  64. }
  65.  
  66. inline unsigned Font::deep(char)
  67. {
  68.   return (charDeep);
  69. }
  70.  
  71. inline unsigned Font::maxDeep(void)
  72. {
  73.   return (charDeep);
  74. }
  75.  
  76. inline void Font::foreground(unsigned colour)
  77. {
  78.   fgColour = colour;
  79. }
  80.  
  81. inline void Font::background(unsigned colour)
  82. {
  83.   bgColour = colour;
  84. }
  85.  
  86. inline unsigned Font::foreground(void)
  87. {
  88.   return (fgColour);
  89. }
  90.  
  91. inline unsigned Font::background(void)
  92. {
  93.   return (bgColour);
  94. }
  95.  
  96. #endif